package com.ncr.travel.appmgr.client.event;

import com.google.gwt.event.shared.GwtEvent;
import com.ncr.travel.appmgr.model.shared.ScreenConfiguration;

public class ConfigChangeEvent extends GwtEvent<ConfigChangeHandler> {
	private static Type<ConfigChangeHandler> TYPE = new Type<ConfigChangeHandler>();

	private ScreenConfiguration screenConfiguration;

	public ConfigChangeEvent() {
	}

	public ConfigChangeEvent(ScreenConfiguration screenConfiguration) {
		this.screenConfiguration = screenConfiguration;
	}

	/**
	 * Gets the event type associated with load events.
	 * 
	 * @return the handler type
	 */
	public static com.google.gwt.event.shared.GwtEvent.Type<ConfigChangeHandler> getType() {
		return TYPE;
	}

	/**
	 * @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
	 */
	@Override
	protected void dispatch(ConfigChangeHandler handler) {
		handler.onConfigChanged(this);
	}

	protected void fire(HasConfigChangeHandlers source) {
		source.fireEvent(new ConfigChangeEvent());
	}

	public static void fire(HasConfigChangeHandlers source, ScreenConfiguration screenConfigurationItemData) {
		source.fireEvent(new ConfigChangeEvent(screenConfigurationItemData));
	}

	@Override
	public com.google.gwt.event.shared.GwtEvent.Type<ConfigChangeHandler> getAssociatedType() {
		return TYPE;
	}

	public ScreenConfiguration getScreenConfiguration() {
		return screenConfiguration;
	}

}
